package com.esri.core.map.popup;

import java.text.SimpleDateFormat;
import java.util.Date;

/* loaded from: classes.dex */
public class PopupDateFormatValue extends PopupFormatValue {
    SimpleDateFormat a;
    DATE_FORMAT b;

    /* loaded from: classes.dex */
    public enum DATE_FORMAT {
        SHORTDATE,
        SHORTDATELE,
        LONGMONTHDAYYEAR,
        DAYSHORTMONTHYEAR,
        LONGDATE,
        SHORTDATELONGTIME,
        SHORTDATELELONGTIME,
        SHORTDATESHORTTIME,
        SHORTDATELESHORTTIME,
        SHORTDATESHORTTIME24,
        SHORTDATELESHORTTIME24,
        SHORTMONTHYEAR,
        LONGMONTHYEAR,
        YEAR;

        public static DATE_FORMAT fromString(String str) {
            DATE_FORMAT[] values;
            if (str == null) {
                return null;
            }
            for (DATE_FORMAT date_format : values()) {
                if (str.equalsIgnoreCase(date_format.toString())) {
                    return date_format;
                }
            }
            return null;
        }
    }

    public PopupDateFormatValue() {
        this.a = null;
        this.b = null;
        this.a = new SimpleDateFormat();
    }

    public PopupDateFormatValue(DATE_FORMAT date_format) {
        this();
        setFormat(date_format);
    }

    public SimpleDateFormat getFormat() {
        return this.a;
    }

    public void setFormat(SimpleDateFormat simpleDateFormat) {
        this.a = simpleDateFormat;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.esri.core.map.popup.PopupDateFormatValue$1  reason: invalid class name */
    /* loaded from: classes.dex */
    public static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[DATE_FORMAT.values().length];
            a = iArr;
            try {
                iArr[DATE_FORMAT.SHORTDATE.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[DATE_FORMAT.SHORTDATELE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[DATE_FORMAT.LONGMONTHDAYYEAR.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[DATE_FORMAT.DAYSHORTMONTHYEAR.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[DATE_FORMAT.LONGDATE.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[DATE_FORMAT.SHORTDATELONGTIME.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[DATE_FORMAT.SHORTDATELELONGTIME.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[DATE_FORMAT.SHORTDATESHORTTIME.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[DATE_FORMAT.SHORTDATELESHORTTIME.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                a[DATE_FORMAT.SHORTDATESHORTTIME24.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                a[DATE_FORMAT.SHORTDATELESHORTTIME24.ordinal()] = 11;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                a[DATE_FORMAT.SHORTMONTHYEAR.ordinal()] = 12;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                a[DATE_FORMAT.LONGMONTHYEAR.ordinal()] = 13;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                a[DATE_FORMAT.YEAR.ordinal()] = 14;
            } catch (NoSuchFieldError unused14) {
            }
        }
    }

    public void setFormat(DATE_FORMAT date_format) {
        switch (AnonymousClass1.a[date_format.ordinal()]) {
            case 1:
                this.a.applyPattern("MM/dd/yyyy");
                break;
            case 2:
                this.a.applyPattern("dd/MM/yyyy");
                break;
            case 3:
                this.a.applyPattern("MMMM dd, yyyy");
                break;
            case 4:
                this.a.applyPattern("dd MMM yyyy");
                break;
            case 5:
                this.a.applyPattern("EEEE, MMMM dd, yyyy");
                break;
            case 6:
                this.a.applyPattern("MM/dd/yyyy h:mm:ss a");
                break;
            case 7:
                this.a.applyPattern("dd/MM/yyyy h:mm:ss a");
                break;
            case 8:
                this.a.applyPattern("MM/dd/yyyy h:mm a");
                break;
            case 9:
                this.a.applyPattern("dd/MM/yyyy h:mm a");
                break;
            case 10:
                this.a.applyPattern("MM/dd/yyyy HH:mm");
                break;
            case 11:
                this.a.applyPattern("dd/MM/yyyy HH:mm");
                break;
            case 12:
                this.a.applyPattern("MMM yyyy");
                break;
            case 13:
                this.a.applyPattern("MMMM yyyy");
                break;
            case 14:
                this.a.applyPattern("yyyy");
                break;
        }
        this.b = date_format;
    }

    @Override // com.esri.core.map.popup.PopupFormatValue
    public String formattedValue(Object obj) {
        if (obj == null) {
            return "";
        }
        if (obj instanceof Long) {
            return this.a.format(new Date(((Long) obj).longValue()));
        }
        if (obj instanceof Date) {
            return this.a.format((Date) obj);
        }
        return obj.toString();
    }
}
